/**
 * Created by douxin on 24/09/2016.
 */

import React from 'react';

class NavItem extends React.Component {

    onMenuClick() {
        if (this.props.id !== 4) {
            return this.props.onMenuClick(this.props.id);
        }
    }

    render() {
        const style = (this.props.id === this.props.selectedMenuIndex) ? 'active': '';
        return (
            <li className={style} onClick={this.onMenuClick.bind(this)}><a>{this.props.name}</a></li>
        );
    }

}

NavItem.propTypes = {
    id: React.PropTypes.number,
    name: React.PropTypes.string,
    selectedMenuIndex: React.PropTypes.number,
    onMenuClick: React.PropTypes.func
};

export default NavItem;